//
//  mainHeadView.m
//  HappyStore
//
//  Created by 陈锋 on 16/6/6.
//  Copyright © 2016年 LLJ. All rights reserved.
//

#import "mainHeadView.h"

@interface mainHeadView ()

@end
@implementation mainHeadView

+(instancetype)loadHeaderView{
    
    mainHeadView *headView =[[mainHeadView alloc] init];
    [headView addsubViews:headView];
    return headView;
}

//添加  子视图
-(void)addsubViews:(UIView *)view{
    UIImageView *tmpView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 20, 75, 75)];
    [tmpView.layer setCornerRadius:(tmpView.frame.size.height/2)];
    [tmpView.layer setMasksToBounds:YES];
    [tmpView setContentMode:UIViewContentModeScaleAspectFill];
    [tmpView setClipsToBounds:YES];
    tmpView.layer.shadowColor = [UIColor whiteColor].CGColor;
    tmpView.layer.shadowOffset = CGSizeMake(4, 4);
    tmpView.layer.shadowOpacity = 0.5;
    tmpView.layer.shadowRadius = 2.0;
    self.imgStr = tmpView;
    
    self.nameStr = [[UILabel alloc]init];
    float with = self.nameStr.text.length * 25;
    self.nameStr.text = @"姓名";
    self.nameStr.font = [UIFont systemFontOfSize:16];
    self.nameStr.textColor = [UIColor colorWithRed:10.0/255.0 green:91.0/255.0 blue:175.0/255.0 alpha:1];
    self.nameStr.textAlignment = NSTextAlignmentLeft;
    self.nameStr.frame = CGRectMake(tmpView.width + 10 + 10,20,with,20);
    
    UIView * lineView = [[UIView alloc]initWithFrame:CGRectMake(self.nameStr.x + self.nameStr.width + 5, 10, 1, 20)];
    lineView.backgroundColor = [UIColor lightGrayColor];
    self.lineview = lineView;
    
    self.positionNameStr = [[UILabel alloc]init];
    float posiWith = self.positionNameStr.text.length * 18;

    self.positionNameStr.font = [UIFont systemFontOfSize:13];
    self.positionNameStr.textColor = [UIColor lightGrayColor];
    self.positionNameStr.textAlignment = NSTextAlignmentLeft;
    self.positionNameStr.frame = CGRectMake(lineView.width + lineView.x + 5,20,posiWith,20);
    
    UIImageView *vImgView = [[UIImageView alloc]initWithFrame:CGRectMake(self.positionNameStr.x + self.positionNameStr.width + 5, 22, 15, 15)];
    self.vStr = vImgView;
    
    UILabel * dianHuaLabel = [[UILabel alloc]initWithFrame:CGRectMake(tmpView.width + 10 + 10, self.nameStr.y + self.nameStr.height + 10, 30, 20)];
    dianHuaLabel.textColor = [UIColor lightGrayColor];
    dianHuaLabel.text = @"电话:";
    dianHuaLabel.font = [UIFont systemFontOfSize:12];
    dianHuaLabel.textAlignment = NSTextAlignmentLeft;
    
    UILabel * phoneLabel = [[UILabel alloc]initWithFrame:CGRectMake(dianHuaLabel.x + dianHuaLabel.width + 5, self.nameStr.y + self.nameStr.height + 10, screenW/2, 20)];
    phoneLabel.textColor = [UIColor lightGrayColor];
    phoneLabel.font = [UIFont systemFontOfSize:12];
    phoneLabel.textAlignment = NSTextAlignmentLeft;
    self.phoneStr = phoneLabel;
    
    UILabel * emailLabel = [[UILabel alloc]initWithFrame:CGRectMake(tmpView.width + 10 + 10, dianHuaLabel.y + dianHuaLabel.height + 5, 30, 20)];
    emailLabel.textColor = [UIColor lightGrayColor];
    emailLabel.text = @"邮箱:";
    emailLabel.font = [UIFont systemFontOfSize:12];
    emailLabel.textAlignment = NSTextAlignmentLeft;
    
    UILabel *  email = [[UILabel alloc]initWithFrame:CGRectMake(dianHuaLabel.x + dianHuaLabel.width + 5, phoneLabel.y + phoneLabel.height + 5,screenW/2, 20)];
     email.textColor = [UIColor lightGrayColor];
     email.font = [UIFont systemFontOfSize:12];
     email.textAlignment = NSTextAlignmentLeft;
    self.emailStr = email;
    
    UIImageView * bottomView = [[UIImageView alloc]initWithFrame:CGRectMake(0, email.y + email.height + 10, screenW, 1)];
    bottomView.image = [UIImage imageNamed:@"xuxian"];
    
    
    
    UIImageView *bottomImgView = [[UIImageView alloc]initWithFrame:CGRectMake(self.imgStr.width, bottomView.y + 12, 15, 15)];
    bottomImgView.image = [UIImage imageNamed:@"房子"];
    
    UILabel *  companyUserName = [[UILabel alloc]initWithFrame:CGRectMake(bottomImgView.x + bottomImgView.width + 5, bottomImgView.y ,screenW/1.5, 20)];
    companyUserName.textColor = [UIColor lightGrayColor];
    companyUserName.font = [UIFont systemFontOfSize:12];
    companyUserName.textAlignment = NSTextAlignmentLeft;
    self.companyUserNameStr = companyUserName;
    
    [view addSubview:self.imgStr];
    [view addSubview:self.nameStr];
    [view addSubview:self.lineview];
    [view addSubview:self.positionNameStr];
    [view addSubview:self.vStr];
    [view addSubview:dianHuaLabel];
    [view addSubview:self.phoneStr];
    [view addSubview:emailLabel];
    [view addSubview:self.emailStr];
    [view addSubview:bottomView];
    [view addSubview:bottomImgView];
    [view addSubview:self.companyUserNameStr];
}

@end
